
#ifndef __GZ_DECOMPRESS_H
#define __GZ_DECOMPRESS_H

#include "../aprtools/APRBucketBrigade.h"
#include "CryptoPipeBlock.h"
#include <zlib.h>

/** Class encapsulating an interface to Zlib decompression. */
class GZDecompress : public CryptoPipeBlock
{
   public:
      GZDecompress();
      GZDecompress(APRBucketBrigade &iinput, APRBucketBrigade &ioutput);
      ~GZDecompress();
      // Decompress data block and return decompressed data block
      char *processDataBlock(const char *inputblock, apr_size_t inputsize, apr_size_t *outputsize);
      // Begin decompression of the data pipe
      int processPipeBegin();
      // Step through the decompression of the data pipe
      int processPipeStep();
      // Step through the data, recording data movement
      int processPipeStep(int *movementin, int *movementout);
      // End decompression of the data pipe
      int processPipeEnd();
      /** Was the process secure? */
      int processWasSecure() { return 1; }
   private:
      /** The input bucket brigade. As this is pointer to the outside,
       * it is not deleted in the destructor. */
      APRBucketBrigade *input;
      /** The output bucket brigade. As this is pointer to the
       * outside, it is not deleted in the destructor. */
      APRBucketBrigade *output;
      /** The zlib stream. */
      z_stream *strm;
};

#endif
